package com.uniledger.exchange.bank;

import android.arch.persistence.room.Dao;
import android.arch.persistence.room.Insert;
import android.arch.persistence.room.Query;

import java.util.Collection;

import io.reactivex.Flowable;

@Dao
public interface BankCardDao {

    /**
     * 查询数据库中的总条目
     * @return
     */
    @Query("SELECT COUNT(bin) FROM BankCard")
    long getCount();

    /**
     * 插入数据
     * @param cards
     */
    @Insert
    void insertAll(Collection<BankCard> cards);

    @Query("SELECT * FROM BankCard WHERE bin= :id")
    Flowable<BankCard> queryCard(String id);
}
